package com.zyz.friend.controller.userexam;

import com.zyz.common.core.constants.HttpConstants;
import com.zyz.common.core.model.Result;
import com.zyz.common.core.model.TableDataInfo;
import com.zyz.friend.aspect.CheckUserStatus;
import com.zyz.friend.model.exam.dto.ExamQueryDTO;
import com.zyz.friend.model.userexam.ExamEnterDTO;
import com.zyz.friend.service.userexam.IUserExamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user/exam")
public class UserExamController {

    @Autowired
    private IUserExamService userExamService;

    @CheckUserStatus
    @RequestMapping(value = "/enter",method = RequestMethod.POST)
    public Result<Void> enter(@RequestHeader(HttpConstants.AUTHENTICATION) String token, @RequestBody ExamEnterDTO examEnterDTO) {
        userExamService.enter(token,examEnterDTO);
        return Result.ok();
    }

    @RequestMapping(value = "/list",method = RequestMethod.GET)
    public TableDataInfo list (ExamQueryDTO examDTO) {
        return userExamService.list(examDTO);
    }

}
